package com.test.util;

public class BaseResponse<T> {

    private String respCode;

    public String getRespCode() {
        return respCode;
    }

    public void setRespCode(String respCode) {
        this.respCode = respCode;
    }

    public String getRespMessage() {
        return respMessage;
    }

    public void setRespMessage(String respMessage) {
        this.respMessage = respMessage;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public T getRespData() {
        return respData;
    }

    public void setRespData(T respData) {
        this.respData = respData;
    }

    private String respMessage;

    private Boolean success;

    private T respData;

    public BaseResponse() {
    }

    public BaseResponse(String respCode, String respMessage, Boolean success, T respData) {
        this.respCode = respCode;
        this.respMessage = respMessage;
        this.success = success;
        this.respData = respData;
    }

    public BaseResponse(String respCode, String respMessage, Boolean success) {
        this.respCode = respCode;
        this.respMessage = respMessage;
        this.success = success;
    }

    public static BaseResponse getBaseResponseFail(String respCode, String respMessage) {
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setRespCode(respCode);
        baseResponse.setRespMessage(respMessage);
        baseResponse.setSuccess(Boolean.FALSE);
        return baseResponse;
    }

    public static BaseResponse getBaseResponseSuccess(Object respData) {
        BaseResponse baseResponse = new BaseResponse();
        baseResponse.setRespCode("JSCPI1001");
        baseResponse.setRespMessage("成功");
        baseResponse.setSuccess(Boolean.TRUE);
        baseResponse.setRespData(respData);
        return baseResponse;
    }
}
